<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>css实现正方形</title>
    <style>
        *{
            box-sizing: border-box;
        }
        .box{
            padding:50px;
            width:500px;height:300px;
            background-color: blue;
        }
        .son{
            width:200px;
            height:100%;
            padding:0 20%;
            background-color: red;
        }
    </style>
</head>
<body>
<div class="box">
    <div class="son"></div>
</div>
</body>
</html>